﻿using System;

namespace LearnExtension
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            int a = 1;
            if (a.In(0, 1))
                Console.WriteLine("1");
            else
                Console.WriteLine("2");

            Console.ReadKey();
        }
    }

    public static class objectExtension
    {
        /// <summary>
        /// 包含两端
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="me"></param>
        /// <param name="lower"></param>
        /// <param name="upper"></param>
        /// <returns></returns>
        public static bool In<T>(this T me, T lower, T upper) where T : IComparable<T>
        {
            return me.CompareTo(lower) >= 0 && me.CompareTo(upper) <= 0;
        }

        //public static <T> operator ABCD(T lower, T upper) where T : IComparable<T>
        //{
        //    //return me.CompareTo(lower) >= 0 && me.CompareTo(upper) <= 0;
        //}

        //public static Test operator $$$(Test t1, Test t2)
        //{
        //    return new Test(t1.ID > t2.ID ? t1.ID : t2.ID);
        //}
    }
}
